In [1]:
import time
import webbrowser
 
import requests
from requests.exceptions import ConnectionError
 
from bokeh.io import hplot, vplot
from bokeh.models import Select, Line, Rect
from bokeh.document import Document
from bokeh.session import Session
from bokeh.plotting import figure
 
document = Document()
session = Session()
session.use_doc('test')
session.load_document(document)


Using saved session configuration for http://localhost:5006/
To override, pass 'load_from_config=False' to Session

In [4]:
factors = ['a','b','c']
 
p = figure(x_range=factors)
p.rect(x=factors, y=[1,2,3], width=0.9, height=1, fill_color="#3B8686")
 
 
def update_data():
    p.x_range.factors = ['a','b','c','d'] 
    session.store_document(document)
    print('updated')
 
def on_widget_change(obj, attr, old, new):
    update_data()
 
def layout():
    select = Select(title="Date:", value="World", options=['option1','option2'])
    select.on_change('value', on_widget_change)
 
    controls = hplot(select)
    layout = vplot(controls, p)
 
    return layout

layout = layout()
document.add(layout)
session.store_document(document)
session.store_objects(p)

link = session.object_link(layout)
webbrowser.open(link)


Out[4]:
True

This displays, but can't get factors to change - haven't tried v. hard - this doesn't seem how i would structure a server doc? I took it from the gist link on the ticket.


In [ ]: